import { ExpertEvaluate } from '@/api/expert';
import { Skeleton } from '@antmjs/vantui';
import { Text, View } from '@tarojs/components';
import { useRouter } from '@tarojs/taro';
import { useRequest } from 'taro-hooks';

export default function Page() {
  const router = useRouter();

  const { data, loading } = useRequest(
    () => ExpertEvaluate({ expertId: router?.params?.id! }),
    {
      ready: !!router?.params?.id,
    }
  );

  if (loading)
    return (
      <View className='p-4'>
        <Skeleton title row='3' />
      </View>
    );

  return (
    <View className=' p-4 space-y-3'>
      {data?.map((item) => (
        <View className=' rounded-lg bg-white p-4' key={item.id}>
          <Text className='font-bold text-black text-lg block'>
            {item.name}
          </Text>
          <Text className=' text-xs mt-1 text-gary1'>{item.msg}</Text>
        </View>
      ))}
    </View>
  );
}
